///////////////////////////////////////////////////////////
//  IndexOrganization.h
//  Implementation of the Class IndexOrganization
//  Created on:      02-Jun-2007 10:55:32 a.m.
///////////////////////////////////////////////////////////

#ifndef INDEX_ORGANIZATION
#define INDEX_ORGANIZATION

#include "Key.h"
#include "OrganizationCommons.h"

class IndexOrganization
{
	private:
		bool CheckExistence(const char* filename);
		bool CheckExistence(int handler);
		bool emptyKey(char *key, unsigned int size);
		void resolveName(const char* organizationName, unsigned int type, char * field, char* filename);
		void getOrganizationFileName(int handler, char *name);

	public:
		IndexOrganization();
		virtual ~IndexOrganization();
	
		int I_CREATE(const char* filename, const campo* reg, const campo* clavePrimaria);
		int I_OPEN(const char* filename, int modo);
		int I_CLOSE(int handler);
		int I_ADD_INDEX(int handler, const campo* clave);
		int I_DROP_INDEX(int handler, int indexId);
		int I_IS_INDEX(int handler, campo* clave);
		int I_START(int handler, int indexId, char* operador, const void* valorReferencia);
		int I_READ(int handler, void* reg);
		int I_READ_NEXT(int handler, int indexId, void* reg);
		int I_WRITE(int handler, const void* reg);
		int I_UPDATE(int handler, const void* reg);
		int I_DELETE(int handler, const void* reg);
		int I_DESTROY(const char* filename);
		int I_MAX(int handler, int indexId, void* reg);
		int I_MIN(int handler, int indexId, void* reg);

};

#endif

